#ifndef TABLECOLUMNLIST_H
#define TABLECOLUMNLIST_H

#include "enums.h"

#include <vector>
#include <string>

// forward declarations.
class TableColumn;

using namespace std;

/*
    Class: TableColumnList
    Represents a list of columns for SQL tables.
*/
class TableColumnList
{
    /* Section: public */
    public:
        /*
            Constructor: Default constructor.
            Initializes the object.
        */
        TableColumnList(vector<TableColumn *> * columns = NULL);

        /*
            Destructor: Default destructor.
            Destroy the object.
        */
        virtual ~TableColumnList();

        /*
            Constructor: Copy constructor.
            Initializes the object as a copy of other TableColumnList object.

            Parameters:
                other - TableColumnList object to copy from.
        */
        TableColumnList(const TableColumnList& other);

        /*
            Method: SetColumns
            Sets a vector of TableColumns to the object. Destroy the previos set of columns if any.

            Parameters:
                columns - vector of TableColumns to set.

            See also:
                Column
        */
        void setColumns(vector<TableColumn *> * columns);

        /*
            Method: GetColumns
            Returns:
                A const pointer to the vector of columns of the object

            See also:
                Column
        */
        vector<TableColumn *> * getColumns() const;

        /*
            Method: AddColumn
            Adds a new column to the ColumList.

            Parameters:
                column - Column to add.

            See also:
                Column
        */
        void addColumn(TableColumn * column);

        /*
            Method: addColumn
            Adds a TableColumn woth the name and type given.

            Parameters:
                name    -   Name of the column.
                type    -   Type of the column.
        */
        void addColumn(const string & name, TableColumnType type);

        /*
            Method: size
            Returns:
                Number of columns of the ColumnList.
        */
        virtual int size();

        /*
            Method: ToString.
            Returns:
                A string representation of the list of columns.
        */
        string toString();

        /*
            Method: GetColumnType

            Parameters:
                name - Column name to get the type.

            Returns:
                The type of the column given.
        */
        TableColumnType getColumnType(const string & name);

        /*
            Method: clone
            Returns:
                A clone of this object.
        */
        TableColumnList * clone();

    /* Section: private */
    private:
        /*
            Variable: columns
            Type: vector<TableColumn *> *
            List of columns.

            See also:
                Column
        */
        vector<TableColumn *> * columns;
};


#endif // TABLECOLUMNLIST_H
